<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="<?=base_url()?>css/admin-bar.css" type="text/css" rel="stylesheet" />
<link href="<?=base_url()?>css/admin-menu.css" type="text/css" rel="stylesheet" />
<link href="<?=base_url()?>css/admin.css" type="text/css" rel="stylesheet" />
<link rel="stylesheet" type="text/css" href="<?=base_url()?>css/demo_page.css" />
<link rel="stylesheet" type="text/css" href="<?=base_url()?>css/demo_table_jui.css" />
<link rel="stylesheet" type="text/css" href="<?=base_url()?>css/smoothness/jquery-ui-1.8.16.custom.css" />
<link href="<?=base_url()?>css/jquery.bubblepopup.v2.3.1.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<?=base_url()?>js/jquery.min.js"></script>

<script src="<?=base_url()?>js/jquery.bubblepopup.v2.3.1.min.js" type="text/javascript"></script>
<script type="text/javascript" src="<?=base_url()?>js/jquery.dataTables.min.js"></script>
<script type="text/javascript">
	$(document).ready(function(){
		$('#example').dataTable( {
			"aaSorting":[[4,'desc']],
			"bJQueryUI": true,
			"sPaginationType": "full_numbers",
			"aoColumns": [{"bSearchable": false, "bSortable": false},
						  {"sWidth":"35%"},
			              {"sWidth":"10%"},
			              null,
			              null,
			              {"bSearchable": false, "bSortable": false}]
		});
		
		$('.delBtn').hover(function(){
			$(this).attr('src','<?=base_url()?>images/trash_hover.png');
		}, function(){
			$(this).attr('src','<?=base_url()?>images/trash.png');
		});
		
		$('.delBtn').click(function(){
			var mabl = ($(this).attr('lang'));
			//alert(masp);
			var conf = confirm("Bạn muốn xóa bình luận?");
			if(conf == true){
				//alert(mabl);
				$.post("<?=base_url()?>index.php/binhluan_controller/xoabinhluan",{mabl:mabl},function(data){
					//alert(matk);
					$('#noi_dung').html(data);
					//alert(masp);
					});
			}else{
				return false;
			}
		});
	})
</script>

<body>
<?=$bar?>
<div id="main-content">
<?=$sidemenu?>
<script type="text/javascript">
	$('#sidemenu #comment').addClass('current-top');
</script>
<div id="content">
	<div id="content-head">
    </div>
    <div id="content-body">
    		<form action="" method="get" name="my_form">
				<div class="widget-title"><span style="font-style:italic">Chào mừng <b style="color:red"><?=$_SESSION['tenadmin']?></b></span></div>
				<hr>
				<b><h2>Quản lý bình luận</h2></b>
				<hr>
            <div id="noi_dung">
			<table cellpadding="0" cellspacing="0" border="0" class="display" id="example">
				<thead>
					<tr>
						<th width="8%">Số thứ tự</th>
						<th>Bình luận</th>
						<th>Tác giả</th>
						<th>Sản phẩm</th>
						<th>Ngày đăng</th>
						<th>Thao tác</th>
					</tr>
				</thead>
				<tbody>
				
				<?php
					for($i=0; $i<count($binhluan); $i++){
						$noi_dung =  $binhluan[$i]['noidung'];
							
							if(strlen($noi_dung)>=80){
								$tom_tat = substr($noi_dung, 0, 80);
								$index = strrpos($tom_tat, " " );
								$tom_tat = substr($tom_tat, 0, $index+1)."...";
							}else{
								$tom_tat = $noi_dung;
						}
						echo"<tr class='gradeU'>";
							echo"<td align='center'>".($i+1)."</td>";
							echo"<td><p title='$noi_dung'>".$tom_tat."</p></td>";
							echo"<td class='center'>".$binhluan[$i]['tendangnhap']."</td>";
							echo"<td>".$binhluan[$i]['tensanpham']."</td>";
							echo"<td class='center'>".$binhluan[$i]['ngaydang']."</td>";
							echo"<td class='center'><a title='Xóa tài khoản'><img lang='".$binhluan[$i]['mabinhluan']."' class='delBtn' src='".base_url()."images/trash.png' height='32' width='32' ></a></td>";
						echo"</tr>";
					}
				?>
				</tbody>
			</table>
            </div>
		</form>	
    </div>
</div>
</div>
</body>
</html>